Testing Documentation

This directory contains the test suite for the SonarQube deployment project. The testing approach focuses on essential functionality to ensure core features are working correctly.

Test Structure

Core Test Cases

  1. Basic Installation Tests
    • SonarQube is running and accessible
    • Health check returns GREEN status
    • Database connection is working
    • Default authentication is functional

Running Tests

Using the Test Runner

The run_tests.py script provides a simple way to execute all tests:

# For Vagrant development environment
./tests/run_tests.py --vagrant

# For production environment
./tests/run_tests.py --host <server-ip>

Manual Test Execution

You can also run individual test components:

# Lint checks
ansible-lint

# Syntax check
ansible-playbook tests/syntax_check.yml

# Integration tests only
pytest -v tests/integration/

Test Dependencies

Required Python packages:

Install dependencies using:

pip install -r requirements.txt

Test Configuration

The test suite can be configured through command-line options:

Interpreting Results

The test runner will provide clear pass/fail indicators:

Full test output will be displayed for any failures to aid in troubleshooting.